// layui导入模块并得到相应模块对象
layui.use(['table', 'layer', 'form', 'jquery', 'laydate'], function () {
    let table = layui.table;
    let layer = layui.layer;
    let form = layui.form;
    let $ = layui.jquery;
    //let laydate = layui.laydate; // 日期时间对象(有日期字段的话就用上)

    // 渲染表格
    table.render({
        //绑定表格对象
        elem: "#syllabusTable",
        //请求方式
        method: "get",
        height: "full-90",
        //请求路径
        url: "/syllabus/restful_syllabus",
        //是否分页
        page: true,
        //表格上方普通工具栏
        toolbar: "#complain_toolbar",
        //每页的行数
        limit: 5,
        cols: [[
            //开启多选框
            {checkbox: true}
            //数据列
            , {field: 'syllabusId', title: '编号',  align: "center", sort: true}
            , {field: 'syllabusDate', title: '日期',  align: "center"}
            ,{field: 'amPm', title: '上课时间',  align: "center"}
            ,{field: 'weekName', title: '星期',  align: "center"}
            ,{field: 'className', title: '班级',  align: "center"}
            ,{field: 'classRoomName', title: '教室',  align: "center"}
            ,{field: 'lessonName', title: '课程名称',  align: "center"}
            ,{field: 'recordName', title: '老师',  align: "center"}
        ]],
        //分页工具栏中每页行数选择器
        limits: [5, 10, 15, 20]
    });


    //多条件查询
    form.on("submit(provinceSearch)", function (obj) {
        //得到表单中的数据
        let data = obj.field;
        //重新加载表格对象
        table.reload("syllabusTable", {
            //页码
            page: {
                curr: 1
            },
            // 多条件数据
            where: {
                syllabusId: data.syllabusId,
                syllabusDate: data.syllabusDate,
                amPm: data.amPm,
                weekName: data.weekName,
                classRoomName: data.classRoomName,
                className: data.className,
                lessonName: data.lessonName,
                recordName: data.recordName,
            }
        });
        return false;
    });


});